﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            loadProduct();
        }
    }
    private void loadProduct()
    {
        ChoDienTuDataContext cdt = new ChoDienTuDataContext();
        lstProduct.DataSource = cdt.Select_AllProduct();
        lstProduct.DataBind();
    }
    public void ShoppingCart_Add(object sender, EventArgs e)
    {
       

        MyCart cart = (MyCart)Session["cart"];
        ImageButton btn = (ImageButton)sender;
        int id = int.Parse(btn.CommandArgument);
        CartItem item = new CartItem(id, 1);
        cart.AddItem(item);

        ASP.masterpage_master master = (ASP.masterpage_master)this.Master;
        master.RefreshShoppingCartInfo();
    }
}